#define _CRT_SECURE_NO_WARNINGS 1
void fanzhuan(int* nums, int i, int j)
{
    int temp;
    while (i <= j)
    {
        temp = nums[i];
        nums[i] = nums[j];
        nums[j] = temp;
        i++;
        j--;
    }
}


void rotate(int* nums, int numsSize, int k) {
    if (k == 0)
    {
        return nums;
    }

    int i, j;
    fanzhuan(nums, 0, numsSize - 1);
    fanzhuan(nums, 0, k % numsSize - 1);
    fanzhuan(nums, k % numsSize, numsSize - 1);
}
